package com.chuanyang.driverh.mainhome.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.response2.join.FleetLineListBean;

import java.util.List;

/**
 * 相思无用，唯别而已。别期若有定，千般煎熬又何如，莫道黯然销魂，何处柳暗花明。
 * Created by sky on 2016/8/12.
 */
public class OftenPathMotorcadeAdapter extends BaseAdapter {

    private List<FleetLineListBean> driverLinesBeanList;
    private LayoutInflater mInflater;
    private Context mContext;

    public OftenPathMotorcadeAdapter(Context activity, List<FleetLineListBean> orderWaitConfirmList) {
        driverLinesBeanList = orderWaitConfirmList;
        mContext = activity;
        mInflater = LayoutInflater.from(activity);
    }

    @Override
    public int getCount() {
        return driverLinesBeanList.size();
    }

    @Override
    public Object getItem(int position) {
        return driverLinesBeanList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_often_path, null);
            holder = new ViewHolder();
            holder.tv_path_num = (TextView) convertView.findViewById(R.id.tv_path_num);
            holder.tv_start_city = (TextView) convertView.findViewById(R.id.tv_start_city);
            holder.tv_end_city = (TextView) convertView.findViewById(R.id.tv_end_city);
            holder.tv_journey = (TextView) convertView.findViewById(R.id.tv_journey);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        //holder.tv_goods_name_modification.setText(goodsEntities.get(position).getGoodsName());
        //holder.iv_bank_card_icon.setImageResource(R.mipmap.ic_launcher);
        holder.tv_path_num.setText("专线");
        holder.tv_start_city.setText(driverLinesBeanList.get(position).getStartCity());
        holder.tv_end_city.setText(driverLinesBeanList.get(position).getTargetCity());
        //holder.tv_journey.setText("储蓄卡");
        return convertView;
    }

    public class ViewHolder {
        public TextView tv_path_num;
        public TextView tv_start_city;
        public TextView tv_end_city;
        public TextView tv_journey;
    }
}
